<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NumCpp: Centroid.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">NumCpp
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">A C++ implementation of the Python Numpy library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_centroid_8hpp_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Centroid.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_centroid_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_types_8hpp.html">NumCpp/Core/Types.hpp</a>&quot;</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_cluster_8hpp.html">NumCpp/ImageProcessing/Cluster.hpp</a>&quot;</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_nd_array_8hpp.html">NumCpp/NdArray.hpp</a>&quot;</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="num2str_8hpp.html">NumCpp/Utils/num2str.hpp</a>&quot;</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacenc.html">nc</a></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;{</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keyword">namespace </span>imageProcessing</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    {</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <span class="comment">//================================================================================</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        <span class="comment">// Class Description:</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment"></span>        <span class="keyword">template</span>&lt;<span class="keyword">typename</span> dtype&gt;</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html">   47</a></span>&#160;        <span class="keyword">class </span><a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid</a></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        {</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <span class="keyword">public</span>:</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment"></span>            <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a8f8f09104f3581a418c7759290989a5a">Centroid</a>() noexcept = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a07de04ddd4361f4e8c5e827f8b63f76a">   62</a></span>&#160;<span class="comment"></span>            <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a07de04ddd4361f4e8c5e827f8b63f76a">Centroid</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_cluster.html">Cluster&lt;dtype&gt;</a>&amp; inCluster) noexcept :</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;                intensity_(inCluster.intensity()),</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;                eod_(inCluster.eod())</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;            {</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;                centerOfMass(inCluster);</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;            }</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#aa3546b7b2430b51650f40fb344ab55a8">   76</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">double</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa3546b7b2430b51650f40fb344ab55a8">row</a>() const noexcept</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;            {</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;                <span class="keywordflow">return</span> row_;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;            }</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a4ef0e9b2faa4999af5c3597a60140d6c">   88</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">double</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a4ef0e9b2faa4999af5c3597a60140d6c">col</a>() const noexcept</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;            {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                <span class="keywordflow">return</span> col_;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            }</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#aa203a8f8138fe9679f307f38ad65a5aa">  100</a></span>&#160;<span class="comment"></span>            dtype <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa203a8f8138fe9679f307f38ad65a5aa">intensity</a>() const noexcept</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;            {</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;                <span class="keywordflow">return</span> intensity_;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;            }</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a098ee235ea6fcf22df2a7a0d80d53e44">  112</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">double</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a098ee235ea6fcf22df2a7a0d80d53e44">eod</a>() const noexcept</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;            {</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                <span class="keywordflow">return</span> eod_;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;            }</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#aa39ae81638b8f7ed7b81d4476e2a6316">  124</a></span>&#160;<span class="comment"></span>            std::string <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa39ae81638b8f7ed7b81d4476e2a6316">str</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;<span class="keyword">            </span>{</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;                std::string out;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;                out += <span class="stringliteral">&quot;row = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a2e3a14fbbce38b0f8710ea0d92ee2ffc">utils::num2str</a>(row_) + <span class="stringliteral">&quot; col = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a2e3a14fbbce38b0f8710ea0d92ee2ffc">utils::num2str</a>(col_);</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;                out += <span class="stringliteral">&quot; intensity = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a2e3a14fbbce38b0f8710ea0d92ee2ffc">utils::num2str</a>(intensity_) + <span class="stringliteral">&quot; eod = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a2e3a14fbbce38b0f8710ea0d92ee2ffc">utils::num2str</a>(eod_) + <span class="stringliteral">&quot;\n&quot;</span>;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;                <span class="keywordflow">return</span> out;</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            }</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;            <span class="comment">//============================================================================</span></div><div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a139efcdd994d1bacdf62d65b3c427d8d">  137</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">void</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a139efcdd994d1bacdf62d65b3c427d8d">print</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="keyword">            </span>{</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;                std::cout &lt;&lt; *<span class="keyword">this</span>;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            }</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a503a2542b388f65fb80710dd33610abc">  152</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">bool</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a503a2542b388f65fb80710dd33610abc">operator==</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid&lt;dtype&gt;</a>&amp; rhs) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;            {</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;                <span class="keywordflow">return</span> row_ == rhs.row_ &amp;&amp; col_ == rhs.col_ &amp;&amp; intensity_ == rhs.intensity_ &amp;&amp; eod_ == rhs.eod_;</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;            }</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a89eb742174a9dd27b730ce4502e119cd">  167</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">bool</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a89eb742174a9dd27b730ce4502e119cd">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid&lt;dtype&gt;</a>&amp; rhs) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            {</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;                <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == rhs);</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;            }</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00185"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a093719e81ed5bd5af0cb80dcfd03289f">  185</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">bool</span> operator&lt;(const Centroid&lt;dtype&gt;&amp; rhs) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;            {</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;                <span class="keywordflow">return</span> intensity_ &lt; rhs.intensity_ ? false : <span class="keyword">true</span>;</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;            }</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00199"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a787da1f79223e97a2788a2ad47e1c394">  199</a></span>&#160;<span class="comment"></span>            <span class="keyword">friend</span> std::ostream&amp; operator&lt;&lt;(std::ostream&amp; inStream, const Centroid&lt;dtype&gt;&amp; inCentriod)</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;            {</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;                inStream &lt;&lt; inCentriod.str();</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;                <span class="keywordflow">return</span> inStream;</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;            }</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        <span class="keyword">private</span>:</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;            <span class="comment">//==================================Attributes================================///</span></div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;            <span class="keywordtype">double</span>          row_{ 0.0 };</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;            <span class="keywordtype">double</span>          col_{ 0.0 };</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;            dtype           intensity_{ 0 };</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;            <span class="keywordtype">double</span>          eod_{ 0.0 };</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;            <span class="comment">//=============================================================================</span></div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;            <span class="comment">// Description:</span></div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;<span class="comment"></span>            <span class="keywordtype">void</span> centerOfMass(<span class="keyword">const</span> Cluster&lt;dtype&gt;&amp; inCluster)</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;            {</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;                <span class="keyword">const</span> Shape clusterShape(inCluster.height(), inCluster.width());</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;                NdArray&lt;dtype&gt; clusterArray(clusterShape);</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;                clusterArray.zeros();</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> rowMin = inCluster.rowMin();</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> colMin = inCluster.colMin();</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;                <span class="keyword">const</span> dtype inten = inCluster.intensity();</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;                <span class="keywordflow">for</span> (<span class="keyword">auto</span>&amp; pixel : inCluster)</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;                {</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;                    clusterArray(pixel.row - rowMin, pixel.col - colMin) = pixel.intensity;</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;                }</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;                <span class="comment">// first get the row center</span></div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;                row_ = 0;</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;                <a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> theRow = rowMin;</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;                <span class="keywordflow">for</span> (<a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> rowIdx = 0; rowIdx &lt; clusterShape.rows; ++rowIdx)</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;                {</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;                    <span class="keywordtype">double</span> rowSum = 0;</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;                    <span class="keywordflow">for</span> (<a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> colIdx = 0; colIdx &lt; clusterShape.cols; ++colIdx)</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;                    {</div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;                        rowSum += <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(clusterArray(rowIdx, colIdx));</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;                    }</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;                    row_ += rowSum * <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(theRow++);</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;                }</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;                row_ /= <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(inten);</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;                <span class="comment">// then get the column center</span></div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;                col_ = 0;</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;                <a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> theCol = colMin;</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;                <span class="keywordflow">for</span> (<a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> colIdx = 0; colIdx &lt; clusterShape.cols; ++colIdx)</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;                {</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;                    <span class="keywordtype">double</span> colSum = 0;</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;                    <span class="keywordflow">for</span> (<a class="code" href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">uint32</a> rowIdx = 0; rowIdx &lt; clusterShape.rows; ++rowIdx)</div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;                    {</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;                        colSum += <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(clusterArray(rowIdx, colIdx));</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;                    }</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;                    col_ += colSum * <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(theCol++);</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;                }</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;                col_ /= <span class="keyword">static_cast&lt;</span><span class="keywordtype">double</span><span class="keyword">&gt;</span>(inten);</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;            }</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        };</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;    }</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;}</div><div class="ttc" id="namespacenc_html"><div class="ttname"><a href="namespacenc.html">nc</a></div><div class="ttdef"><b>Definition:</b> Coordinate.hpp:45</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_aa3546b7b2430b51650f40fb344ab55a8"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#aa3546b7b2430b51650f40fb344ab55a8">nc::imageProcessing::Centroid::row</a></div><div class="ttdeci">double row() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:76</div></div>
<div class="ttc" id="namespacenc_html_aacba4d66f94f6f53637e23c5d82e20d8"><div class="ttname"><a href="namespacenc.html#aacba4d66f94f6f53637e23c5d82e20d8">nc::uint32</a></div><div class="ttdeci">uint32_t uint32</div><div class="ttdef"><b>Definition:</b> Types.hpp:41</div></div>
<div class="ttc" id="_cluster_8hpp_html"><div class="ttname"><a href="_cluster_8hpp.html">Cluster.hpp</a></div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_a4ef0e9b2faa4999af5c3597a60140d6c"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a4ef0e9b2faa4999af5c3597a60140d6c">nc::imageProcessing::Centroid::col</a></div><div class="ttdeci">double col() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:88</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_a89eb742174a9dd27b730ce4502e119cd"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a89eb742174a9dd27b730ce4502e119cd">nc::imageProcessing::Centroid::operator!=</a></div><div class="ttdeci">bool operator!=(const Centroid&lt; dtype &gt; &amp;rhs) const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:167</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html">nc::imageProcessing::Centroid</a></div><div class="ttdoc">holds the information for a centroid </div><div class="ttdef"><b>Definition:</b> Centroid.hpp:47</div></div>
<div class="ttc" id="_nd_array_8hpp_html"><div class="ttname"><a href="_nd_array_8hpp.html">NdArray.hpp</a></div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_a139efcdd994d1bacdf62d65b3c427d8d"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a139efcdd994d1bacdf62d65b3c427d8d">nc::imageProcessing::Centroid::print</a></div><div class="ttdeci">void print() const</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:137</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_a07de04ddd4361f4e8c5e827f8b63f76a"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a07de04ddd4361f4e8c5e827f8b63f76a">nc::imageProcessing::Centroid::Centroid</a></div><div class="ttdeci">Centroid(const Cluster&lt; dtype &gt; &amp;inCluster) noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:62</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_a098ee235ea6fcf22df2a7a0d80d53e44"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a098ee235ea6fcf22df2a7a0d80d53e44">nc::imageProcessing::Centroid::eod</a></div><div class="ttdeci">double eod() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:112</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_cluster_html"><div class="ttname"><a href="classnc_1_1image_processing_1_1_cluster.html">nc::imageProcessing::Cluster</a></div><div class="ttdoc">Holds the information for a cluster of pixels. </div><div class="ttdef"><b>Definition:</b> Cluster.hpp:53</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_aa203a8f8138fe9679f307f38ad65a5aa"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#aa203a8f8138fe9679f307f38ad65a5aa">nc::imageProcessing::Centroid::intensity</a></div><div class="ttdeci">dtype intensity() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:100</div></div>
<div class="ttc" id="_types_8hpp_html"><div class="ttname"><a href="_types_8hpp.html">Types.hpp</a></div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_a503a2542b388f65fb80710dd33610abc"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a503a2542b388f65fb80710dd33610abc">nc::imageProcessing::Centroid::operator==</a></div><div class="ttdeci">bool operator==(const Centroid&lt; dtype &gt; &amp;rhs) const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:152</div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_a8f8f09104f3581a418c7759290989a5a"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a8f8f09104f3581a418c7759290989a5a">nc::imageProcessing::Centroid::Centroid</a></div><div class="ttdeci">Centroid() noexcept=default</div></div>
<div class="ttc" id="num2str_8hpp_html"><div class="ttname"><a href="num2str_8hpp.html">num2str.hpp</a></div></div>
<div class="ttc" id="classnc_1_1image_processing_1_1_centroid_html_aa39ae81638b8f7ed7b81d4476e2a6316"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#aa39ae81638b8f7ed7b81d4476e2a6316">nc::imageProcessing::Centroid::str</a></div><div class="ttdeci">std::string str() const</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:124</div></div>
<div class="ttc" id="namespacenc_1_1utils_html_a2e3a14fbbce38b0f8710ea0d92ee2ffc"><div class="ttname"><a href="namespacenc_1_1utils.html#a2e3a14fbbce38b0f8710ea0d92ee2ffc">nc::utils::num2str</a></div><div class="ttdeci">std::string num2str(dtype inNumber) noexcept</div><div class="ttdef"><b>Definition:</b> num2str.hpp:45</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_34171bd951b13a53aa9f237277a18e40.html">NumCpp</a></li><li class="navelem"><a class="el" href="dir_d4391026049f7aede16e9c18d53d30b9.html">ImageProcessing</a></li><li class="navelem"><a class="el" href="_centroid_8hpp.html">Centroid.hpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
